Admin Operations

This guide covers all administrative operations for the WTDLiquidityManager contract.

Prerequisites

1

Create the pool

Create a Uniswap v4 pool for the WTD/USDC pair via the Uniswap interface.

2

Add liquidity

Add liquidity to the pool and obtain an LP NFT (position token ID).

3

Pool requirements

The pool must use fee = 3000 (0.30%) and tick spacing = 60.

Locking a Position

Signature
lockLiquidity(tokenId, unlockTime) → lockId

Locks a Uniswap v4 LP NFT in the contract.

Parameters:

  • tokenId: The NFT token ID of the LP position

  • unlockTime: Timestamp when the position can be unlocked, or type(uint256).max for eternal lock

Requirements:

  • The position must have non-zero liquidity

  • The position must be in the correct WTD/USDC pool (fee=3000, tickSpacing=60)

  • Unlock time must be in the future (and less than 1e10 unless it's ETERNAL_LOCK)

  • Caller must own the NFT (it will be transferred to the contract)

Returns: lockId — a unique identifier for this lock

Access: DEFAULT_ADMIN_ROLE

Eternal Lock

To create a permanent, irrevocable liquidity lock:

lockLiquidity(tokenId, type(uint256).max)

Eternal locks can never be unlocked. Fees can still be collected.

Collecting Fees

Signature
collectFees(lockId, recipient) → (amount0, amount1)

Collects accumulated trading fees from a locked position without removing liquidity.

Parameters:

  • lockId: The lock ID returned by lockLiquidity

  • recipient: Address to receive the collected fees

Returns:

  • amount0: Amount of token0 (lower address token) collected

  • amount1: Amount of token1 (higher address token) collected

How it works: The contract sends a zero-liquidity decrease to the Uniswap v4 PositionManager, which triggers fee collection without affecting the position's liquidity.

Access: DEFAULT_ADMIN_ROLE (must be the lock owner)

Unlocking a Position

Signature
unlockLiquidity(lockId)

Unlocks a locked position and returns the LP NFT to the lock owner.

Requirements:

  • Current time must be past the unlock time

  • Caller must be the lock owner

  • Cannot unlock eternal locks

The function automatically collects any pending fees before returning the NFT.

Access: DEFAULT_ADMIN_ROLE (must be the lock owner)

View Functions

Function
Description

getLockInfo(lockId)

Get full lock details (owner, tokenId, unlockTime, liquidity, poolKey)

isLocked(lockId)

Check if a lock is still active

poolKey()

Get the configured WTD/USDC pool key

Lock Info Fields

Field
Description

lockId

Unique lock identifier

owner

Address that created the lock

tokenId

Uniswap v4 LP NFT token ID

unlockTime

Timestamp when unlock becomes possible

liquidity

Amount of liquidity in the position at lock time

poolKey

Uniswap v4 pool parameters